package com.j2eefast.flowable.erp.service;


import com.j2eefast.flowable.erp.entity.bpmErpPersonAccountupdateEntity;
import com.j2eefast.flowable.erp.mapper.bpmErpPersonAccountupdateMapper;
import com.j2eefast.common.core.mutidatasource.annotaion.DataSource;
import com.j2eefast.common.core.page.Query;
import com.j2eefast.common.core.utils.PageUtil;
import com.j2eefast.common.core.utils.ToolUtil;
import com.j2eefast.framework.utils.Constant;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
import java.util.Arrays;
/**
 *
 * ERP人事账户更新Service接口
 * @author: yhli
 * @date 2020-07-20 18:43
 */
@Service
public class bpmErpPersonAccountupdateService extends ServiceImpl<bpmErpPersonAccountupdateMapper,bpmErpPersonAccountupdateEntity> {

	@Resource
	private bpmErpPersonAccountupdateMapper bpmErpPersonAccountupdateMapper;

	/**
	 * mybaitis-plus 页面分页查询
     */
    @DataSource(name="FLOWABLE")
	public PageUtil findPage(Map<String, Object> params) {
        QueryWrapper<bpmErpPersonAccountupdateEntity> queryWrapper = new QueryWrapper<bpmErpPersonAccountupdateEntity>();
           String serialNumber = (String) params.get("serialNumber");
         queryWrapper.eq(ToolUtil.isNotEmpty(serialNumber), "serial_number", serialNumber);
             String applyUsername = (String) params.get("applyUsername");
        queryWrapper.like(ToolUtil.isNotEmpty(applyUsername), "apply_username", applyUsername);
                         String accountType = (String) params.get("accountType");
         queryWrapper.eq(ToolUtil.isNotEmpty(accountType), "account_type", accountType);
             String beneficiaryUsername = (String) params.get("beneficiaryUsername");
        queryWrapper.like(ToolUtil.isNotEmpty(beneficiaryUsername), "beneficiary_username", beneficiaryUsername);
          String salaryType = (String) params.get("salaryType");
         queryWrapper.eq(ToolUtil.isNotEmpty(salaryType), "salary_type", salaryType);
          String salaryMoney = (String) params.get("salaryMoney");
         queryWrapper.eq(ToolUtil.isNotEmpty(salaryMoney), "salary_money", salaryMoney);
                      String accountingPerson = (String) params.get("accountingPerson");
         queryWrapper.eq(ToolUtil.isNotEmpty(accountingPerson), "accounting_person", accountingPerson);
                String accountingCrossTime = (String) params.get("accountingCrossTime");
         queryWrapper.eq(ToolUtil.isNotEmpty(accountingCrossTime), "accounting_cross_time", accountingCrossTime);
          String processStatus = (String) params.get("processStatus");
         queryWrapper.eq(ToolUtil.isNotEmpty(processStatus), "process_status", processStatus);
  		Page<bpmErpPersonAccountupdateEntity> page = bpmErpPersonAccountupdateMapper.selectPage(new Query<bpmErpPersonAccountupdateEntity>(params).getPage(), queryWrapper);
		return new PageUtil(page);
    }

    /**
     * 自定义分页查询，含关联实体对像
     */
    @DataSource(name="FLOWABLE")
	public PageUtil findPage(Map<String, Object> params,bpmErpPersonAccountupdateEntity bpmErpPersonAccountupdateEntity) {
		Page<bpmErpPersonAccountupdateEntity> page = bpmErpPersonAccountupdateMapper.findPage(new Query<bpmErpPersonAccountupdateEntity>(params).getPage(), bpmErpPersonAccountupdateEntity,(String) params.get(Constant.SQL_FILTER))  ;
		return new PageUtil(page);
	}
	/**
     * 批量删除
     */
    @DataSource(name="FLOWABLE")
	@Transactional(rollbackFor = Exception.class)
	public boolean deletebpmErpPersonAccountupdateByIds(String[] ids) {
		return removeByIds(Arrays.asList(ids));
	}

	/**
     * 单个删除
     */
    @DataSource(name="FLOWABLE")
	public boolean deletebpmErpPersonAccountupdateById(String id) {
		return removeById(id);
	}

	/**
     * 保存
     */
    @DataSource(name="FLOWABLE")
	public boolean savebpmErpPersonAccountupdate(bpmErpPersonAccountupdateEntity bpmErpPersonAccountupdate){
        return save(bpmErpPersonAccountupdate);
    }

	/**
     * 修改根居ID
     */
    @DataSource(name="FLOWABLE")
	public boolean updatebpmErpPersonAccountupdateById(bpmErpPersonAccountupdateEntity bpmErpPersonAccountupdate) {
		return updateById(bpmErpPersonAccountupdate);
	}

	/**
     * 根居ID获取对象
     */
    @DataSource(name="FLOWABLE")
	public bpmErpPersonAccountupdateEntity getbpmErpPersonAccountupdateById(String id){
		return getById(id);
	}
}
